package auction



import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
 */
@TestFor(Customer)
class CustomerTests {

    void testNoAtSignEmail() {
       def pass = "12345678"
       def email = "briangmail.com"

       Customer customer = new Customer(password: pass, emailAddress: email)

       assert !customer.validate() : "Customer with no @ in email valid."
    }

    void testNoEmail() {
        def pass = "12345678"

        Customer customer = new Customer(password: pass)

        assert !customer.validate() : "Customer with no email valid."
    }

    void testNoPassword() {
       def email = "briangmail.com"

       Customer customer = new Customer(emailAddress: email)

       assert !customer.validate() : "Customer with no password valid."
     }

    void testShortPassword() {
       def pass = "12345"
       def email = "brian@gmail.com"

       Customer customer = new Customer(password: pass, emailAddress: email)

       assert !customer.validate() : "Customer with password too short valid."
    }

    void testLongPassword() {
        def pass = "123456789"
        def email = "brian@gmail.com"

        Customer customer = new Customer(password: pass, emailAddress: email)

        assert !customer.validate() : "Customer with password too long valid."
    }
}
